package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo1 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        System.out.println(c);

        System.out.println(c.size());
        System.out.println(c.isEmpty());
        c.clear();
        System.out.println("清空");
        System.out.println(c);
        System.out.println(c.size());
        System.out.println(c.isEmpty());

        c.add(new Point(100,200));
        c.add(new Point(300,200));
        c.add(new Point(100,200));
        System.out.println(c);
        Point p =new Point(100,200);
        System.out.println("是否包含"+c.contains(p));
        c.remove(p);
        System.out.println(c);
        System.out.println("是否包含"+c.contains(p));
        c.add(p);
        System.out.println("是否包含"+c.contains(p));
        System.out.println(c);
        c.remove(p);
        System.out.println(c);
    }
}
